import request from '@/utils/request'

export function login(data) {
  return request({
    url: '/user/login',
    method: 'post',
    data
  })
}

export function getInfo() {
  return request({
    url: '/user/info',
    method: 'post',
  })
}

export function logout() {
  return request({
    url: `/user/logout`,
    method: 'post'
  })
}

export function register(user,code) {
  return request({
    url: `/user/register/${code}`,
    method: 'post',
    data: user
  })
}

export function updateMail(user,code) {
  return request({
    url: `/user/updateMail/${code}`,
    method: 'post',
    data: user
  })
}

export function sendCode(code) {
  return request({
    url: `/user/sendmail/${code}`,
    method: 'post'
  })
}

export function getUserById(user) {
  return request({
    url: `/user/getUserById`,
    method: 'post',
    data: user
  })
}

export function updateUser(user) {
  return request({
    url: `/user/updateUser`,
    method: 'post',
    data: user
  })
}

export function forgotPasswordSendCode(user) {
  return request({
    url: `/user/forgotPasswordSendCode`,
    method: 'post',
    data: user
  })
}

export function updatePassword(user,userCode) {
  return request({
    url: `/user/updatePassword/${userCode}`,
    method: 'post',
    data: user
  })
}
